#!/usr/bin/python
# -*- coding: utf-8 -*-
# little thing models.py

from django.db import models
from django.contrib.auth.models import User
from django.forms import ModelForm

class Thing(models.Model):
    WISH_STATUS = 1
    PROCESS_STATUS = 2
    FINISH_STATUS = 3
    CANCEL_STATUS = 4
    STATUS_CHOICES = (
        (WISH_STATUS, 'wish'),
        (PROCESS_STATUS, 'process'),
        (FINISH_STATUS, 'finish'),
        (CANCEL_STATUS, 'cancel'),
    )

    title = models.CharField(max_length=20)
    status = models.IntegerField(choices=STATUS_CHOICES,default=WISH_STATUS)
    author = models.ForeignKey(User)
    pub_date = models.DateTimeField(auto_now_add=True)

    def __unicode__(self):
        return self.title
    def get_absolute_url(self):
        return "/littlething/%i" % self.id

class Action(models.Model):
    title = models.CharField(max_length=40)
    thing = models.ForeignKey(Thing)
    content = models.TextField(max_length=2000)
    pub_date = models.DateTimeField(auto_now_add=True)
    author = models.ForeignKey(User)

    def __unicode__(self):
        return self.title
